package com.tjufe;

public class SmartHome {
    private static final SmartHome smartHome = new SmartHome();
    private SmartHome () {
    }
    public static SmartHome getInstance() {
        return smartHome;
    }


    public void control(JD jd) {
        System.out.println(jd.getName()+"状态目前是："+(jd.isStatus()?"开":"关"));
        System.out.println("开始您的操作。。。");
        jd.press();
        System.out.println(jd.getName()+"状态已经是："+(jd.isStatus()?"开":"关"));
    }

    public void showAll(JD[] jds) {
        // 遍历数组，调用控制方法
        for (int i = 0; i < jds.length; i++) {
            JD jd = jds[i];
            System.out.println((i+1)+"、"+jd.getName()+"状态目前是："+(jd.isStatus()?"开":"关"));

        }
    }
}
